package com.bkhc.common.repository;


import com.bkhc.common.entity.ApiInfo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ApiInfoRepository extends JpaRepository<ApiInfo,String> , JpaSpecificationExecutor<ApiInfo> {


    List<ApiInfo> findByApiType(String s);

    @Query("SELECT r FROM ApiInfo r where r.code in (select ur.apiCode from RoleApi ur where ur.roleCode=?1)")
    List<ApiInfo> findAllByRoleCode(String roleCode);

    ApiInfo findByCode(String code);
}
